Suppose, for example, you want to build both MipsIV and a MipsIII versions of a shared object. You want your program to use the MipsIV version when it is running on a Power Challenge (R8000) system, and also run correctly on another 64-bit platform. Suppose you want to do the above with the routines in as library named libchange.so. To do this, build one version of the routines in libchange using the -mips4 option, and place it in /usr/lib64/mips4 on a Power Challenge system. Next, build another version using the -mips3 option, and place it in /usr/lib64. Then, when you build an executable that uses libchange, use the -rpath option to tell the run-time linker to look first for MipsIV versions of the libraries. For example:
cc -mips3 -o prog prog.o -rpath /usr/lib64/mips4 -lchange
As a result, prog runs on any IRIX 6.0 system, and it automatically takes advantage of any MipsIV libraries whenever it runs on a Power Challenge system.